home *** CD-ROM | disk | FTP | other *** search
/ Chip 2003 November / Chip Kasım 2003.iso / prog / openoff / f_0316 / scalc.jar / text / scalc / guide / userdefined_function.xml < prev    next >
Encoding:
Extensible Markup Language  |  2002-01-24  |  6.5 KB  |  96 lines

  1. <?xml version="1.0" encoding="utf-8"?>
  2. <html><head><title>Defining Functions Yourself</title><meta name="filename" content="text/scalc/guide/userdefined_function"/><meta name="language" content="en-US"/><help:css-file-link xmlns:help="http://openoffice.org/2000/help"/><!--The CSS style header method for setting styles--><style type="text/css">
  3.  
  4.         table.Tabelle1{
  5.                 }
  6.         span.Tabelle1A{
  7.                 width:18cm;}
  8.         td.Tabelle1A1{
  9.                 }
  10.         p.P1{
  11.                 }
  12.         p.P2{
  13.                 }
  14.         p.P3{
  15.                 }
  16.         p.P4{
  17.                 }
  18.         p.P5{
  19.                 }
  20.         span.T1{
  21.                 font-weight:bold;}
  22.         span.fr1{
  23.                 }
  24.         </style></head><body>
  25.    
  26.    
  27.    <p class="P1"/>
  28.    <p class="Head1"><help:key-word value="functions; user-defined" tag="kw68166_1" xmlns:help="http://openoffice.org/2000/help"/><help:key-word value="user-defined functions" tag="kw68166_4" xmlns:help="http://openoffice.org/2000/help"/><help:key-word value="Basic IDE; applying" tag="kw68166_3" xmlns:help="http://openoffice.org/2000/help"/><help:key-word value="IDE; Basic" tag="kw68166_2" xmlns:help="http://openoffice.org/2000/help"/><help:to-be-embedded Eid="userdefined_function" xmlns:help="http://openoffice.org/2000/help"><help:link Id="68166">Defining Functions Yourself</help:link></help:to-be-embedded></p>
  29.    <p class="Paragraph">You can apply user-defined functions in <help:productname xmlns:help="http://openoffice.org/2000/help">%PRODUCTNAME</help:productname> Calc in the following ways:</p>
  30.    <ul class="L1">
  31.     <li class="">
  32.      <p class="P2">In the <help:productname xmlns:help="http://openoffice.org/2000/help">%PRODUCTNAME</help:productname> Help you will find information for when you want to program the functions as <help:link Id="66872" xmlns:help="http://openoffice.org/2000/help">add-ins</help:link>. This method requires advanced knowledge of programming.</p>
  33.     </li>
  34.     <li class="">
  35.      <p class="P2">Using the Basic-IDE, even without any knowledge of programming, you can define your own functions. You will find the instructions in the following lines:</p>
  36.     </li>
  37.    </ul>
  38.    <p class="Paragraph">In this example we define a VOL(a; b; c) function which calculates the volume of a rectangular parallelepiped with side lengths a, b and c.</p>
  39.    <p class="Head2">Defining Your Own Functions in Basic IDE</p>
  40.    <table><tr class=""><td class="Tabelle1A1" style="text-align:left;"><span class="Tabelle1A">
  41.       <p class="TableHead"><draw:image draw:style-name="fr1" draw:name="Grafik1" text:anchor-type="paragraph" svg:width="12.801cm" svg:height="8.578cm" draw:z-index="0" xlink:href="67342" xlink:type="simple" xlink:show="embed" xlink:actuate="onLoad" draw:filter-name="GIF - Graphics Interchange" xmlns:draw="http://openoffice.org/2000/drawing" xmlns:text="http://openoffice.org/2000/text" xmlns:svg="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink"/></p>
  42.      </span></td></tr></table>
  43.    <p class="Paragraph"/>
  44.    <ol class="L2">
  45.     <li class="">
  46.      <p class="P3">Choose <span class="T1">Tools - Macro</span>. The <span class="T1">Macro</span> dialog appears.</p>
  47.     </li>
  48.     <li class="">
  49.      <p class="P3">Click the <span class="T1">Edit</span> button. You will now see the Basic IDE.</p>
  50.     </li>
  51.     <li class="">
  52.      <p class="P3">Enter the function, as displayed in the illustration.</p>
  53.     </li>
  54.     <li class="">
  55.      <p class="P3">Close the Basic-IDE window with the close area on the title bar.</p>
  56.      <p class="P3">Your function is automatically saved in the default module and is from now on always available in your <help:productname xmlns:help="http://openoffice.org/2000/help">%PRODUCTNAME</help:productname>. If you apply the function in a Calc document, which is to be used on another computer, you can copy the function to the Calc document. You will find the instructions below under the heading "Copying user-defined functions to a document".</p>
  57.     </li>
  58.    </ol>
  59.    <p class="Head2">Applying a user-defined function in <help:productname xmlns:help="http://openoffice.org/2000/help">%PRODUCTNAME</help:productname> Calc.</p>
  60.    <p class="Paragraph">Once you have defined the function VOL(a; b; c) in the Basic-IDE, you can apply it in exactly the same way as the built-in functions of <help:productname xmlns:help="http://openoffice.org/2000/help">%PRODUCTNAME</help:productname> Calc.</p>
  61.    <ol class="L3">
  62.     <li class="">
  63.      <p class="P4">Open a <help:productname xmlns:help="http://openoffice.org/2000/help">%PRODUCTNAME</help:productname> Calc document and enter a few numbers, for example, in columns A, B and C.</p>
  64.     </li>
  65.     <li class="">
  66.      <p class="P4">Set the cursor in cell D1 and enter the following:</p>
  67.      <p class="P4">=VOL(A1;B1;C1)</p>
  68.      <p class="P4">The function is evaluated and you will see the result in cell D1.</p>
  69.     </li>
  70.    </ol>
  71.    <p class="Head2">Copying user-defined functions to a document</p>
  72.    <p class="Paragraph">In stage 2 of "Defining a user-defined function in Basic-IDE" in the <span class="T1">Macro</span> dialog you clicked on <span class="T1">Edit </span>. As the default, in the <span class="T1">Macro from</span> field the <span class="T1">soffice - Default - Module1</span> module is selected. The default module resides locally in your user directory.</p>
  73.    <p class="Paragraph">If you want to copy the user-defined function to a Calc document, proceed as follows:</p>
  74.    <ol class="L4">
  75.     <li class="">
  76.      <p class="P5">Choose <span class="T1">Tools - Macro</span>.</p>
  77.     </li>
  78.     <li class="">
  79.      <p class="P5">In the <span class="T1">Macro from</span> field select <span class="T1">soffice - Default - Module1</span>. Click <span class="T1">Edit</span>.</p>
  80.     </li>
  81.     <li class="">
  82.      <p class="P5">In the Basic-IDE select the source of your user-defined function and copy it to the clipboard. Close the Basic-IDE.</p>
  83.     </li>
  84.     <li class="">
  85.      <p class="P5">Choose <span class="T1">Tools - Macro</span>.</p>
  86.     </li>
  87.     <li class="">
  88.      <p class="P5">In the <span class="T1">Macro from</span> field select <span class="T1">(Name of the Calc document)- Default - Module1</span>. Click <span class="T1">Edit</span>.</p>
  89.     </li>
  90.     <li class="">
  91.      <p class="P5">Paste the clipboard contents in the Basic-IDE of the document.</p>
  92.     </li>
  93.    </ol>
  94.    <p class="ParaList"><help:embedded Id="65598" Eid="related" xmlns:help="http://openoffice.org/2000/help"/></p>
  95.    <p class="ParaList">Switch to "<help:productname xmlns:help="http://openoffice.org/2000/help">%PRODUCTNAME</help:productname> Basic Help", then search for "Integrated Development Environment (IDE)".</p>
  96.   </body></html>